FROM golang:alpine AS base
WORKDIR /app
EXPOSE 8080

FROM golang:alpine AS build
WORKDIR /src

ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.io,direct
WORKDIR /src
COPY . .
RUN go env && go build -o server main.go


FROM base AS final
LABEL MAINTAINER="kang"
WORKDIR /app
COPY --from=build /src .
ENTRYPOINT ./server
EXPOSE 8080